﻿#include "PlayConfig.h"
#include "qdialog.h"
#include "ui_PlayConfig.h"
#include <QPainter>
#include <QPushButton>
#include <QTabBar>

PlayConfig::PlayConfig(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PlayConfig)
{
    ui->setupUi(this);
    
    ui->PTabCtrl->tabBar()->setFixedWidth(this->width());
}

PlayConfig::~PlayConfig()
{
    delete ui;
}
bool PlayConfig::eventFilter(QObject *obj, QEvent *event)
{
    if (obj == ui->PTabCtrl)
    {
        if (event->type() == QEvent::Resize)
        {
            ui->PTabCtrl->tabBar()->setFixedWidth(this->width());
        }
    }
    return QDialog::eventFilter(obj, event);
}

void PlayConfig::resizeEvent(QResizeEvent *event)
{
    QDialog::resizeEvent(event);
    ui->PTabCtrl->tabBar()->setFixedWidth(this->width());
}

void PlayConfig::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    painter.fillRect(this->rect(),Qt::black);
    QDialog::paintEvent(event);
}
